home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / util / wb / DosMan121.lha / man / If < prev    next >
Text File  |  1995-05-05  |  5KB  |  137 lines

  1.  
  2.  
  3.  
  4.             IF(V1.3 in C:) (2.x/3.x Internal)
  5.  
  6.  
  7.  
  8.      NAME
  9.             IF - Add intelligent branching to scripts.
  10.  
  11.      SYNOPSIS
  12.             IF NOT WARN ERROR FAIL string1EQstring2 
  13.         string1GTstring2 string1GEstring2 VAL EXISTS
  14.             
  15.  
  16.      DESCRIPTION
  17.             If the condition tested by IF evaluates to TRUE, then 
  18.         the commands immediately following the IF, up to the 
  19.         following ELSE or ENDIF, are executed. If the condition 
  20.         tested by IF evaluates to FALSE, it moves the execution 
  21.         of the file ahead to the command following the next ELSE 
  22.         command (if there is one), or to ENDIF, if there is no 
  23.         intervening ELSE.
  24.  
  25.             The ELSE command (if used) must show up between the 
  26.         IF and ENDIF statements.
  27.  
  28.      CONDITIONS
  29.             Each of the following will evaluate to true or false:
  30.  
  31.           WARN 
  32.             This will be true if the return code value set by the 
  33.         last command is greater than or equal to 5.
  34.  
  35.           ERROR
  36.             This will be true if the return code value set by the 
  37.         last command is greater than or equal to 10.
  38.  
  39.           FAIL
  40.             This will be true if the return code value set by the 
  41.         last command is greater than or equal to 20.  Note that 
  42.         you will have to use a Failat command to raise the 
  43.         default fail limit from 10 to above 20 if you wish to use 
  44.         this test.
  45.  
  46.           string1EQstring2
  47.             This takes two strings, and will be true if both 
  48.         arguments are the same (i.e., EQUAL).  The default is a 
  49.         string comparison, but see VAL, below. The comparison is 
  50.         not case sensitive. The test can be reversed by using the 
  51.         NOT keyword with it. It can be a numberic comparison if 
  52.         you utilize the VAR keyword. Strings 1 & 2 are normally 
  53.         text, if there are spaces in the strings then quotes must 
  54.         be placed around it. 
  55.  
  56.             Environmental variables may also substitute a string 
  57.         by using a dollar sign ($) directly before the the 
  58.         variable name (so, $Amount represents the variable 
  59.         Amount).
  60.  
  61.           string1GEstring2 
  62.             Takes two arguments. This will be true if the first 
  63.         argument is Greater than or Equal to the second argument.  
  64.         This may be combined with NOT (see below) to perform a LT 
  65.         (less than) test. The default comparison is a string 
  66.         compare, use VAL to compare numbers.  Strings 1 & 2 are 
  67.         normally text, if there are spaces in the strings then 
  68.         quotes must be placed around it. 
  69.  
  70.             Environmental variables may also substitute a string 
  71.         by using a dollar sign ($) directly before the the 
  72.         variable name (so, $Amount represents the variable 
  73.         Amount).
  74.  
  75.           string1GTstring2
  76.             Takes two arguments. This will be true if the first 
  77.         argument is Greater than the second.  This may be 
  78.         combined with NOT (see below) to construct a LE (less 
  79.         than or equal to) test.  The default comparison is a 
  80.         string compare, but use VAL to compare numbers. Case 
  81.         sensitivity does not matter. Strings 1 & 2 are normally 
  82.         text, if there are spaces in the strings then quotes must 
  83.         be placed around it. 
  84.  
  85.             Environmental variables may also substitute a string 
  86.         by using a dollar sign ($) directly before the the 
  87.         variable name (so, $Amount represents the variable 
  88.         Amount).
  89.  
  90.           EXISTS
  91.             This takes one argument, which should be a device, 
  92.         file or directory.  This will be TRUE if the device, file 
  93.         or directory exists. 
  94.  
  95.      MODIFIERS
  96.             The following options to IF modify the meaning of the 
  97.         above tests:
  98.  
  99.           NOT  
  100.             Inverts the sense of the test.  This is always used 
  101.         in combination with another keyword. As an example, the 
  102.         line: "If NOT EQ" will be TRUE if the EQ is false. This 
  103.         modifier combines with any of the others.
  104.  
  105.           VAL 
  106.             This affects the type of compare done by the EQ GT 
  107.         and GE keywords. By default, the comparison is a string 
  108.         compare.  However, if you specify this keyword, the 
  109.         comparison performed is numeric.
  110.  
  111.             If you don't use the VAL keyword then the string will 
  112.         be compared one numeral at a time from left to right.  
  113.         For instance the string 22 will be shown to be greater 
  114.         than 011 since the first character is 0 in the second
  115.         string which is smaller than 2 in the first.
  116.  
  117.      OTHER
  118.             2.x/3.x contains this command is internal. The only 
  119.         other difference between the 1.3 & 2.x/3.x version is 
  120.         that the 2.x/3.x version can be executed directly from 
  121.         the command line, while the diskbased version cannot.
  122.  
  123.           
  124.      EXAMPLE
  125.             1. If you are running Workbench 3.0, the CLI will say 
  126.         "An Execellent decsion. If you are running any other OS 
  127.         then you get a message saying "Why not?"
  128.  
  129.           IF EXISTS Workbench3.0
  130.               Echo "An excellent decision!"
  131.           ELSE
  132.               Echo "Why not?"
  133.           ENDIF
  134.  
  135.      SEE ALSO
  136.            Execute Assign
  137.